package com.cloud.controller;

import com.cloud.pojo.UserInfo;
import com.cloud.service.UserManagerFeignService;
import com.cloud.tools.CommonResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @Author: Tangtao
 * @Date: 2022/5/2 21:52
 * @Description: Access the user management service provider
 * @ClassName: UserManagerController
 */

@RestController
public class UserManagerController {

    @Resource
    private UserManagerFeignService userManagerFeignService;


    /* 用户注册 */
    @PostMapping(value = "/natms/user/register")
    public CommonResult register(@RequestBody UserInfo userInfo) {
        return userManagerFeignService.register(userInfo);
    }

    /* 用户手机号登录 */
    @PostMapping(value = "/natms/user/loginByPhone")
    public CommonResult loginByPhone(@RequestBody Map<String,String> map){
        return userManagerFeignService.loginByPhone(map);
    }


    /* 用户身份证登录 */
    @PostMapping(value = "/natms/user/loginByCardId")
    public CommonResult loginByCardId(@RequestBody Map<String,String> map) {
        return userManagerFeignService.loginByCardId(map);
    }

    /* 用户修改个人信息 */
    @PostMapping(value = "/natms/user/updateInfo")
    public CommonResult updateInfo(@RequestBody Map<String,String> map) {
        return userManagerFeignService.updateInfo(map);
    }

    @GetMapping(value = "/natms/user/getInfo")
    public CommonResult getInfo(){
        return userManagerFeignService.getInfo();
    }

    @PostMapping(value = "/natms/user/updatePwd")
    public CommonResult updatePwd(@RequestBody Map<String,String> map){
        return userManagerFeignService.updatePwd(map);
    }

    @GetMapping(value = "/natms/user/AllInfo")
    public CommonResult getAllUserInfo(){
        return userManagerFeignService.getAllUserInfo();
    }

    @PostMapping(value = "/natms/user/delete")
    public CommonResult deleteUserInfo(@RequestBody Map<String,String> map){
        return userManagerFeignService.deleteUserInfo(map);
    }

    @PostMapping(value = "/natms/user/updateType")
    public CommonResult updateType(@RequestBody Map<String,String> map){
        return userManagerFeignService.updateType(map);
    }

    @GetMapping("/natms/user/LogCheck")
    public CommonResult getLog() {
        return userManagerFeignService.getLog();
    }
}
